<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>驴友网-发表公告</title>

<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
<script src="js/uploadPicture.js"></script>
<link href="umeditor/themes/default/css/umeditor.css" type="text/css"
	rel="stylesheet">
<script type="text/javascript" src="umeditor/third-party/jquery.min.js"></script>
<script type="text/javascript"
	src="umeditor/third-party/template.min.js"></script>
<script type="text/javascript" charset="utf-8"
	src="umeditor/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8"
	src="umeditor/umeditor.min.js"></script>
<script type="text/javascript" src="umeditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
	<div class="container-fluid">
		<div class="panel admin-panel">
			<div class="panel-head">
				<strong class="icon-reorder"> 发表公告</strong>
			</div>
			<div class="padding border-bottom">
				<div class="row">
					<div class="col-lg-1" style="margin:15px;">
						<strong>公告信息</strong>
					</div>
					<div class="col-lg-5">
						<input class="form-control input-lg" type="text"
							placeholder="请在这里填写公告" id="notice">
					</div>
					<div class="col-lg-3">
						<a class="button border-yellow" id="add"><span
							class="icon-plus-square-o"></span> 添加内容</a>
					</div>
				</div>
			</div>
		</div>
		<div class="panel admin-panel margin-top">
			<div class="panel-head" id="add">
				<strong><span class="icon-pencil-square-o"></span>发布资讯</strong>
			</div>
			<div class="body-content">
				<form method="post" class="form-x"
					action="<c:url value='/pushNotificationServlet'/>"
					enctype="multipart/form-data">
					<div class="form-group">
						<div class="label">
							<label>栏目名称：</label>
						</div>
						<div class="field">
							<input type="text" class="input w50" name="title" value=""
								data-validate="required:请输入标题" />
							<div class="tips"></div>
						</div>
					</div>
					<div class="form-group">
						<div class="label">
							<label>栏目图片：</label>
						</div>
						<div class="field">
							<div id="preview">
								<img id="imghead" border="0" src="images/photo_icon.png"
									width="90" height="90" onclick="$('#previewImg').click();">
							</div>
							<input type="file" onchange="previewImage(this)"
								style="display: none;" id="previewImg" name="picture"
								name="picture">
						</div>
					</div>
					<div class="form-group">
						<div class="label">
							<label>关键字描述：</label>
						</div>
						<div class="field">
							<!--style给定宽度可以影响编辑器的最终宽度-->
							<script type="text/plain" id="myEditor"
								style="width:1000px;height:200px;">
                     
                 </script>
						</div>
					</div>

					<div class="form-group">
						<div class="label">
							<label>布局：</label>
						</div>
						<div class="field">
							<select name="pid" class="input w50">
								<option value="home">首页轮播</option>
								<option value="right">右侧资讯</option>
							</select>
						</div>
					</div>

					<div class="form-group">
						<div class="label">
							<label></label>
						</div>
						<div class="field">
							<button class="button bg-main icon-check-square-o" type="submit">
								提交</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	//实例化编辑器
	var um = UM.getEditor('myEditor');
	window.onload = function() {};
</script>
<script type="text/javascript">

	$('#add').click(

		function() {
			if ($('#notice').val() == "") {

				alert("请输入公告内容");
				return;
			}
			$.ajax({
				url : "<c:url value='/sendNoticeServlet'/>",
				dataType : "text",
				type : "post",
				data : {
					'notice' : $('#notice').val()
				},
				success : function(data) {

					alert("发布成功");
					$('#notice').val("");
				}
			});

		}
	);
</script>
</html>